from fastapi import APIRouter

from app.api.api_model import SuccessResponse
from app.utils.logger import get_logger

logger = get_logger()
    
router = APIRouter(
    prefix="/info",
    tags=["Info"],
)

@router.get("/print-routes", summary="打印所有可用的路由到日志")
async def print_routes():
    for route in router.routes:
        if hasattr(route, "methods"):
            methods = ",".join(route.methods)
            logger.info(f"{methods}\t{route.path}")
    return SuccessResponse(data={"message": f"路由已打印到日志:{router.routes}"})